package com.example.springcloudeurekaserverproducer.controller;

import com.alibaba.fastjson.JSON;
import com.example.springcloudeurekaserverproducer.services.KanbanPolicepresonServices;
import com.example.springcloudeurekaserverproducer.vo.KanbanPolicepreson;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import java.util.Collection;

@RestController
@RequestMapping("/kanban")
public class KanbanController {
	@Value("${age}")
	private String age;
	@Autowired
	private KanbanPolicepresonServices kanbanPolicepresonServices;
	@RequestMapping(value = "/select",method = RequestMethod.GET)
	public BaseBean select(KanbanPolicepreson info) {
		System.out.println("age = " + age + "," + "当前类=KanbanController.select()");
//		BaseBean b=new BaseBean();
//////		b.setData(kanbanPolicepresonServices.select(info));
//////		b.setCode(1);
//////		b.setMsg("");
		return  new BaseBean<Collection<KanbanPolicepreson>>(kanbanPolicepresonServices.select(info)) ;
	}
	@PostMapping(value = "/insert")
	public BaseBean<Long> insert(KanbanPolicepreson info) {
		return new BaseBean<Long>((long) kanbanPolicepresonServices.insert(info));
	}
	@PostMapping(value = "/delete")
	public BaseBean<Long> delete(KanbanPolicepreson info) {
		return new BaseBean<Long>((long) kanbanPolicepresonServices.delete(info));
	}
	@PostMapping(value = "/update")
	public BaseBean<Long> update(KanbanPolicepreson info) {
		return new BaseBean<Long>((long) kanbanPolicepresonServices.update(info));
	}
}
